import { generateHighlightNode } from '@/utils/bizUtils';
const CLASSIFICATION_OPTIONS_NAME = 'classificationOptions';
const tableColumns = [
  {
    title: 'SPU编码',
    key: 'spuNo'
  },
  {
    title: '商品名称',
    key: 'productName'
  },
  {
    title: '品牌',
    key: 'brandName'
  },
  {
    title: '系列',
    key: 'brandseries'
  },
  {
    title: '商品管理区域',
    key: 'manageAreaName'
  },
  {
    title: '四级类编码',
    children: [
      {
        title: '原值',
        key: 'categoryNo'
      },
      {
        title: '现值',
        key: 'categoryNoUpdate'
      }
    ]
  },
  {
    title: '品类树',
    children: [
      {
        title: '原值',
        key: 'categoryPath'
      },
      {
        title: '现值',
        key: 'categoryPathUpdate'
      }
    ]
  },
  {
    title: '归属部门',
    key: 'belongingDeptName'
  },
  {
    title: '归类名称',
    children: [
      {
        title: '原值',
        key: 'classificationName'
      },
      {
        title: '现值',
        key: 'classificationUuidUpdate',
        type: 'classificationSelect',
        optionsName: CLASSIFICATION_OPTIONS_NAME
      }
    ]
  },
  {
    title: '税率',
    children: [
      {
        title: '原值',
        key: 'taxRate'
      },
      {
        title: '现值',
        key: 'taxRateUpdate'
      }
    ]
  },
  {
    title: '操作',
    key: 'action',
    align: 'center',
    fixed: 'right'
  }
]
const errMsg = [
  {
    title: '异常原因',
    key: 'commitFailReason'
  }
]
const showErrMsgColumns = errMsg.concat(tableColumns);
const viewTableColumns = [
  {
    title: 'SPU编码',
    key: 'spuNo'
  },
  {
    title: '商品名称',
    key: 'productName'
  },
  {
    title: '品牌',
    key: 'brandName'
  },
  {
    title: '系列',
    key: 'brandseries'
  },
  {
    title: '商品管理区域',
    key: 'manageAreaName'
  },
  {
    title: '四级类编码',
    children: [
      {
        title: '原值',
        key: 'categoryNo'
      },
      {
        title: '现值',
        render: (h, { row }) => generateHighlightNode(h, row, 'categoryNo')
      }
    ]
  },
  {
    title: '品类树',
    children: [
      {
        title: '原值',
        key: 'categoryPath'
      },
      {
        title: '现值',
        render: (h, { row }) => generateHighlightNode(h, row, 'categoryPath')
      }
    ]
  },
  {
    title: '归属部门',
    key: 'belongingDeptName'
  },
  {
    title: '归类名称',
    children: [
      {
        title: '原值',
        key: 'classificationName'
      },
      {
        title: '现值',
        render: (h, { row }) => generateHighlightNode(h, row, 'classificationName')
      }
    ]
  },
  {
    title: '税率',
    children: [
      {
        title: '原值',
        key: 'taxRate'
      },
      {
        title: '现值',
        render: (h, { row }) => generateHighlightNode(h, row, 'taxRate')
      }
    ]
  }
]
export {
  tableColumns,
  showErrMsgColumns,
  viewTableColumns,
  CLASSIFICATION_OPTIONS_NAME
}
